home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
-
- #include <stdio.h>
- #define PI 3.14159265358979323
-
- enum tokentype {
- Open, Close, Reserved, Identifier, Integer, Float, Str, Eof, Error,
- Semicolon, Comma, Equal, Comment, OpenCurly, CloseCurly,
- };
-
- enum reservedword {
- _geometry,
-
- _vertex, _line, _circle,
- _bezier, _length,
- _vertpath, _animation, _conic,
- _angle, _ratio,
-
- _ray12, _longline, _segment,
-
- _diamond, _plus, _cross, _nomark, _soliddiamond,
-
- // colors:
-
- _black, _red, _green, _blue, _yellow, _cyan, _magenta, _white,
- _invisible, _smear, _blink,
- _c0, _c1, _c2, _c3, _c4, _c5, _c6, _c7, _c8, _c9, _c10, _c11,
- _c12, _c13, _c14, _c15, _c16, _c17, _c18, _c19, _c20, _c21,
- _c22, _c23, _c24, _c25, _c26, _c27, _c28, _c29, _c30, _c31,
-
- // layers:
-
- _l0, _l1, _l2, _l3, _l4, _l5, _l6, _l7, _l8, _l9, _l10, _l11,
- _l12, _l13, _l14, _l15, _l16, _l17, _l18, _l19, _l20, _l21,
- _l22, _l23, _l24, _l25, _l26, _l27, _l28, _l29, _l30, _l31,
-
- _free, _vonl, _vonc, _v_ll, _v_vvmid, _v_lc, _v_cc,
- _v_vvratio, _v_avv, _v_ccenter, _v_lvmirror, _vonconic,
- _v_vcinv, _v_lconic,
-
- _l_vv, _l_vlperp, _l_vlpar, _l_vc, _l_ccext, _l_ccint,
- _l_conicv,
-
- _c_vv, _c_vvv, _c_lll, _c_vlen, _c_ccinv, _c_lcinv,
-
- _bez_vvvv,
-
- _ratio_vvv,
-
- _len_vv, _len_plus, _len_minus, _len_f, _len_times, _len_divide,
-
- _a_vvv,
-
- _conic_vvvvv, _conic_lllll,
-
- _animate, _vpath, _text, _comment,
-
- // parsing info:
-
- _float, _int2, _int4, _none,
-
- // macro stuff:
-
- _macro,
- };
-
- #include "geom.h"
-
- enum atomtype {
- RESERVEDWORD, ATOM, INTEGER, FLOAT, STR,
- };
-
- struct symtableentry {
- char symbol[30]; // name in geom file
- // char name[30]; // display name
- reservedword value;
- primitive *p;
- float f;
- long i;
- };
-
- extern char texttoken[];
- extern float floattoken;
- extern long longtoken;
- extern long restable, idtable;
- extern long xsize, ysize, llx, lly;
- extern reservedword currentlinetype;
- extern long showinvisible;
-
- extern primitive *pselected;
- extern float pbsize;
-
- tokentype gettoken(FILE *);
-
- extern long newtable(long size);
- extern void cleartable(long tt);
- extern symtableentry *lookup(long tt, char *str);
- extern void removeentry(long tt, char *str);
- extern symtableentry *addentry(long tt, char *str, reservedword value);
- extern void inittables();
- void parseerror(char *, long);
- void parseerror(char *);
- void displaymessage(char *);
- vertex *hitvertex(float, float);
- void initialize();
- void initscreen();
- void drawgeom();
- void drawui();
- void recalcsizes();
- void clearplist();
- vertex *hitvertex(float, float);
- line *hitline(float, float);
- line *hitanotherline(float, float, primitive *);
- circle *hitcircle(float, float);
- circle *hitanothercircle(float, float, primitive *);
- void getpoint(float *, float *, long, long);
- vertex *makevertex(float, float);
- line *linevertvert(vertex *, vertex *);
- circle *circvertvert(vertex *, vertex *);
- vertex *vertlineline(line *, line *);
- void verttoline(vertex *, line *);
- void verttocirc(vertex *, circle *);
- line *linevertlineperp(vertex *, line *);
- line *linevertlinepar(vertex *, line *);
- void mainloop();
- void selectvertex(float, float);
- void addprimitive(primitive *);
- primitive *hitprimitive(float, float);
- vertex *vertvertvertmid(vertex *, vertex *);
- long readgeometry(char *);
- void checkconstraints();
- vertex *linecirctovert1(line *, circle *, float, float);
- line *vertcirctoline1(vertex *, circle *, float, float);
- void deleteprimitive(primitive *);
- line *circcirctolineext1(circle *, circle *, float, float);
- line *circcirctolineint1(circle *, circle *, float, float);
- vertex *circcirctovert1(circle *, circle *, float, float);
- vertex *circcirctovert2(circle *, circle *);
- circle *vvvtocircle(vertex *, vertex *, vertex *);
- conic *vvvvvtoconic(vertex *, vertex *, vertex *, vertex *, vertex *);
- long dumpPostScript(char *);
- void cleartable(long);
- void setpcolor(primitive *, long);
- void setlinetype(line *, reservedword);
- void initfakefile(char *);
- long parsefile(FILE *);
- void genname(primitive *);
- void inittables();
- void displaymessage(char *);
- void removeentry(long, char *);
- long readlispexpression(FILE *);
- long readlispfile(FILE *);
- long newtable(long);
- symtableentry *lookup(long, char *);
- symtableentry *addentry(long, char *, reservedword);
- tokentype gettoken(FILE *);
- void parseerror(char *, long);
- long printall(char *s);
- void vertonlineline(vertex *, line *, line *);
- float vvdist(vertex *, vertex *);
- float vldist(vertex *, line *);
- void solvevlc(line *, circle *, vertex *, long);
- void homogenizeline(line *);
- void line_vertcircletan(line *);
- void line_circcircleint(line *);
- void line_circcircleext(line *);
- void vert_circcircle(vertex *);
- void vert_lineconic(vertex *);
- void circle_lll(circle *);
- void circle_vvv(circle *);
- void circle_ccinvert(circle *);
- void v_vcinvert(vertex *);
- void circle_linecinvert(circle *);
- void vlvmirror(vertex *);
- void conic_vvvvv(conic *);
- void projecttoconic(vertex *, conic *);
- void ratio_vvv(length *);
- void v_vvratio(vertex *);
- void a_vvv(length *);
- void v_avv(vertex *);
- void a_atrisect(length *);
- void conic_lllll(conic *);
- void linetangenttoconic(line *);
-